<!-- 头部 -->
<header class="bg-light sticky-top" style="box-shadow: 5px 5px 5px #cfcccc;">

    <div class="container">
        <!-- 导航 -->
        <nav class="navbar navbar-expand-lg navbar-dark">

            <!-- logo -->
            <a class="navbar-brand" href="/index"></a>
            <button class="navbar-toggler" type="button" data-toggle="collapse"
                    data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

            <!-- 功能 -->
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item ml-3 btn-group-vertical">
                        <a class="nav-link" href="/">
                            <i class="bi bi-house"></i> 首页
                        </a>
                    </li>

                    {#                        <li class="nav-item ml-3 btn-group-vertical" th:if="${loginUser != null}">#}
                    {#                            <a class="nav-link position-relative" th:href="@{/letter/list}">#}
                    {#                                <i class="bi bi-envelope"></i> 消息#}
                    {#                                <span class="badge badge-danger"#}
                    {#                                      th:text="${allUnreadCount!=0 ? allUnreadCount : ''}"></span>#}
                    {#                            </a>#}
                    {#                        </li>#}


                    {% if current_user.username %}
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="/user/profile/{{ current_user.id }}"><i
                                    class="bi bi-person-fill"></i> 我的</a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="{{ "/data" }}"> <i class="bi bi-clipboard-data"></i> 数据</a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="/post/publish"> <i class="bi bi-file-earmark-arrow-up"></i>
                                发布</a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <img src="{{ current_user.header_url }}" class="rounded-circle" style="width:30px;"/>
                            </a>
                            <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <a class="dropdown-item text-center" href="/user/profile/{{ current_user.id }}"><i
                                        class="bi bi-person-fill"></i> 个人主页</a>
                                <a class="dropdown-item text-center" href="{{ "/user/setting" }}"><i
                                        class="bi bi-gear"></i> 账号设置</a>
                                <a class="dropdown-item text-center" href="/logout"><i
                                        class="bi bi-box-arrow-right"></i> 退出登录</a>
                                <div class="dropdown-divider"></div>
                                <span class="dropdown-item text-center text-secondary">
                                    {{ current_user.username }}
                                </span>
                            </div>
                        </li>
                    {% else %}
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="/register">注册</a>
                        </li>

                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="/login">登录</a>
                        </li>
                    {% endif %}





                    <!--							<li class="nav-item ml-3 btn-group-vertical">-->
                    <!--								<a class="nav-link" href="https://gitee.com/veal98/CS-Wiki">🔥 CS-Wiki</a>-->
                    <!--							</li>-->

                </ul>

                <!-- 搜索 -->
                <form class="form-inline my-2 my-lg-0" method="get"
                      action="/search">
                    <input class="form-control mr-sm-2" type="search" name="keyword"
                           aria-label="Search" placeholder="{{ "PSDN由此开始..." if not tdy_hot else tdy_hot }}"/>
                    <button class="btn btn-outline-light my-2 my-sm-0 serach-btn" type="submit"><i
                            class="bi bi-search"></i> 搜索
                    </button>
                </form>

            </div>
        </nav>
    </div>
</header>